<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>手写Promise</title>

</head>

<body>

    <script src="./Promise.js"></script>

    <script>

        var p1 = new Promise((resolve, reject)=>{
            setTimeout(()=>{
                resolve('p1')
            }, 1200)
        })
        
        var p2 = new Promise((resolve, reject)=>{
            setTimeout(()=>{
                reject('p2')
            }, 1500)
        })
        
        var p3 = new Promise((resolve, reject)=>{
            setTimeout(()=>{
                reject('p3')
            }, 1300)
        })
        

        Promise.allSettled([p2, p1, p3])
        .then(
            r => {
                console.log('成功', r)
            },
            e => {
                console.log('失败', e)
            }
        )

    </script>

</body>

</html>